﻿CREATE TABLE [dbo].[t_Note] (
    [ID]               INT             IDENTITY (1, 1) NOT NULL,
    [LoanID]           INT             NOT NULL,
    [Note]             NVARCHAR (4000) NULL,
    [StatusID]         INT             NOT NULL,
    [StatusDate]       DATETIME        NOT NULL,
    [StatusUser]       VARCHAR (32)    NOT NULL,
    [DateDue]          DATETIME        NULL,
    [DateDueBy]        VARCHAR (32)    NULL,
    [NoteTypeID]       INT             NOT NULL,
    [NoteActionCodeID] INT             NOT NULL,
    [Phone]            VARCHAR (16)    NULL,
    [PhoneCategoryID]  TINYINT         NOT NULL,
    [NoteDate]         DATETIME        NOT NULL,
    [IsTask]           BIT             NOT NULL,
    [NoteUser]         VARCHAR (32)    NOT NULL,
    [NoteDate0]        AS              ([dbo].[Today]([NoteDate])) PERSISTED,
    [NoteDate1]        AS              ([NoteDate]-dateadd(day,(0),datediff(day,(0),[NoteDate]))) PERSISTED,
    [IsResolved]       BIT             NOT NULL,
    [IsCollection]     BIT             NULL,
    [VantageID]        INT             NULL,
    [DateDue0]         AS              ([dbo].[clr_Date]([DateDue])) PERSISTED
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = NULL, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N't_Note', @level2type = N'COLUMN', @level2name = N'StatusDate';

